﻿namespace QLPhongKham.UC
{
    using DevExpress.Utils;
    using DevExpress.XtraEditors;
    using DevExpress.XtraEditors.Controls;
    using DevExpress.XtraEditors.Mask;
    using DevExpress.XtraEditors.Repository;
    using DevExpress.XtraTab;
    using DevExpress.XtraTreeList;
    using DevExpress.XtraTreeList.Columns;
    using DevExpress.XtraTreeList.Nodes;
    using QLPhongKham.Access;
    using QLPhongKham.Access.BenhNhan;
    using QLPhongKham.BaseClass.BenhNhan;
    using System;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Windows.Forms;
    using UserControls;

    public class ucbn_tiepdon : XtraUserControl
    {
        private DataTable _dttiepdon;
        private int _iiddangnhap;
        private BNTiepDon _objtiepdon;
        private ucbn_thongtinbn _ucbn;
        private General _xuli;
        private SimpleButton btntimbn;
        private IContainer components;
        private ctrdanhsach ctrdanhsach_bn;
        private DateEdit datengaygio;
        private GroupControl groupControl1;
        private GroupControl groupControl2;
        private GroupControl groupControl3;
        private Label label1;
        private Label label12;
        private Label label14;
        private Label label15;
        private Label label16;
        private Label label17;
        private Label label18;
        private Label label19;
        private Label label2;
        private Label label20;
        private Label label21;
        private Label label22;
        private Label label23;
        private Label label24;
        private Label label3;
        private Label label30;
        private Label label4;
        private Label label5;
        private Label label6;
        private Label label7;
        private Label label8;
        private LookUpEdit lkephong;
        private LookUpEdit lkploaituoi;
        private RadioButton rdbnam;
        private RadioButton rdbnu;
        private RepositoryItemTextEdit repositoryItemTextEdit1;
        private SimpleButton sbtnboqua;
        private SimpleButton sbtnchidinh;
        private SimpleButton sbtnketthuc;
        private SimpleButton sbtnluu;
        private SimpleButton sbtnsua;
        private SimpleButton sbtntieptheo;
        private TreeList tldk;
        private TreeListColumn tldk_idql;
        private TreeListColumn tldk_ten;
        private TextEdit txtcannang;
        private TextEdit txtdiachi;
        private TextEdit txtdienthoai;
        private TextEdit txthoten;
        private TextEdit txthuyetap;
        private TextEdit txtlydokham;
        private TextEdit txtmabn2;
        private TextEdit txtmach;
        private TextEdit txtmaphuongxa;
        private TextEdit txtnamsinh;
        private MaskedTextBox txtngaysinh;
        private TextEdit txtnhietdo;
        private TextEdit txtstt;
        private TextEdit txttenphuongxa;
        private TextEdit txttuoi;

        public ucbn_tiepdon()
        {
            this._iiddangnhap = 0;
            this.components = null;
            this.InitializeComponent();
            this._xuli = new General();
        }

        public ucbn_tiepdon(General xuli, int iddangnhap)
        {
            this._iiddangnhap = 0;
            this.components = null;
            this.InitializeComponent();
            this._xuli = xuli;
            this._iiddangnhap = iddangnhap;
        }

        private void btntimbn_Click(object sender, EventArgs e)
        {
            this._ucbn = new ucbn_thongtinbn(this._xuli);
            this._ucbn.pLayThongTinBN = true;
            base.Controls.Add(this._ucbn);
            this._ucbn.Height = base.Height;
            this._ucbn.Width = base.Width;
            this._ucbn.Location = new Point(0, 0);
            this._ucbn.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
            this._ucbn.BringToFront();
        }

        private void ctrdanhsach_bn_Validated(object sender, EventArgs e)
        {
            try
            {
                DataTable dongHienTai = this.ctrdanhsach_bn.DongHienTai;
                this.f_SetControl_benhnhan(dongHienTai.Rows[0]["mabn"].ToString());
            }
            catch
            {
            }
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private bool f_kiemtra_luu()
        {
            string text = this.txtmabn2.Text;
            if (this.datengaygio.Tag == null)
            {
                this.datengaygio.Tag = 0;
            }
            if ((this.datengaygio.Tag.ToString() != "0") && (text.Length < 10))
            {
                MessageBox.Show("Chưa nhập m\x00e3 bệnh nh\x00e2n.", "Th\x00f4ng b\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                this.txtmabn2.Focus();
                return false;
            }
            if (this.txthoten.Text == "")
            {
                MessageBox.Show("Chưa nhập họ v\x00e0 t\x00ean của bệnh nh\x00e2n.", "Th\x00f4ng b\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                this.txthoten.Focus();
                return false;
            }
            try
            {
                int num = Convert.ToInt16(this.txtnamsinh.Text);
            }
            catch
            {
                MessageBox.Show("Chưa nhập năm sinh của bệnh nh\x00e2n.", "Th\x00f4ng b\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                this.txtnamsinh.Focus();
                return false;
            }
            try
            {
                int num2 = Convert.ToInt16(this.txttuoi.Text);
            }
            catch
            {
                MessageBox.Show("Chưa nhập tuổi hoặc số tuổi của bệnh nh\x00e2n kh\x00f4ng đ\x00fang.", "Th\x00f4ng b\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                this.txttuoi.Focus();
                return false;
            }
            try
            {
                DateTime time = new DateTime(Convert.ToInt16(this.datengaygio.Text.Substring(6, 4)), Convert.ToInt16(this.datengaygio.Text.Substring(3, 2)), Convert.ToInt16(this.datengaygio.Text.Substring(0, 2)), Convert.ToInt16(this.datengaygio.Text.Substring(11, 2)), Convert.ToInt16(this.datengaygio.Text.Substring(14, 2)), 0);
                if (DateTime.Now < ((DateTime) this.datengaygio.EditValue))
                {
                    MessageBox.Show("Ng\x00e0y giờ đăng k\x00fd kh\x00e1m kh\x00f4ng được lớn hơn ng\x00e0y hiện tại.", "Th\x00f4ng b\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    this.datengaygio.Focus();
                    return false;
                }
            }
            catch
            {
                MessageBox.Show("Ng\x00e0y giờ kh\x00f4ng đ\x00fang.", "Th\x00f4ng b\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                this.datengaygio.Focus();
                return false;
            }
            if (this.lkephong.EditValue == null)
            {
                MessageBox.Show("Chưa nhập khoa ph\x00f2ng cho bệnh nh\x00e2n.", "Th\x00f4ng b\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                this.lkephong.Focus();
                return false;
            }
            try
            {
                int num3 = Convert.ToInt16(this.txtstt.Text);
            }
            catch
            {
                MessageBox.Show("Số thứ tự của bệnh nh\x00e2n kh\x00f4ng đ\x00fang.", "Th\x00f4ng b\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                this.txtstt.Focus();
                return false;
            }
            return true;
        }

        private void f_loacontrol_benhnhan_enable(bool chophepsua)
        {
            this.txthoten.Enabled = this.rdbnam.Enabled = this.rdbnu.Enabled = this.txtngaysinh.Enabled = this.txtnamsinh.Enabled = this.txtdiachi.Enabled = this.txtdienthoai.Enabled = this.txtmaphuongxa.Enabled = this.txttenphuongxa.Enabled = this.txttuoi.Enabled = this.lkploaituoi.Enabled = chophepsua;
        }

        private void f_loadcontrol_benhnhan(string mabn, string hoten, int gioitinh, string ngaysinh, string namsinh, string diachi, string dienthoai, long idphuongxa)
        {
            try
            {
                this.txtmabn2.Text = mabn;
            }
            catch
            {
            }
            bool chophepsua = true;
            if ((mabn != "") && (new BNDanhMuc(this._xuli.pConFigData).f_load_bn_dsbenhnhan(mabn).Rows.Count > 0))
            {
                chophepsua = new BNThongSo(this._xuli.pConFigData).pTD_A3_SuaThongTinBenhNhan(this._iiddangnhap);
                this.f_loacontrol_benhnhan_enable(chophepsua);
            }
            this.f_loacontrol_benhnhan_enable(chophepsua);
            if (!chophepsua)
            {
                this.datengaygio.Focus();
            }
            this.txthoten.Text = hoten;
            if (gioitinh == 0)
            {
                this.rdbnam.Checked = true;
            }
            else
            {
                this.rdbnu.Checked = true;
            }
            this.txtngaysinh.Text = ngaysinh;
            this.txtnamsinh.Text = namsinh.ToString();
            this.txtnamsinh_Validated(null, null);
            this.txtdiachi.Text = diachi;
            this.txtdienthoai.Text = dienthoai;
            this.f_setcontrol_phuongxa("", idphuongxa);
        }

        private void f_loadcontrol_caclandk(string mabn)
        {
            this.tldk.ClearNodes();
            DataTable table = new DataTable();
            table = this._objtiepdon.f_loaddata_caclandk(mabn);
            this._dttiepdon = table.Copy();
            for (int i = 0; i < table.Rows.Count; i++)
            {
                TreeListNode parentNode = this.tldk.AppendNode(new object[] { table.Rows[i]["ngay"].ToString() + " [" + table.Rows[i]["tendoituong"].ToString() + "]", table.Rows[i]["idql"].ToString() }, (TreeListNode) null);
                TreeListNode node2 = this.tldk.AppendNode(new object[] { table.Rows[i]["tenphong"].ToString(), table.Rows[i]["idql"].ToString() }, parentNode);
                node2 = this.tldk.AppendNode(new object[] { table.Rows[i]["lydokham"].ToString(), table.Rows[i]["idql"].ToString() }, parentNode);
            }
        }

        private void f_loadcontrol_chophepsua(bool chophep)
        {
            this.sbtntieptheo.Enabled = this.sbtnketthuc.Enabled = this.sbtnsua.Enabled = this.groupControl3.Enabled = !chophep;
            this.sbtnluu.Enabled = this.sbtnboqua.Enabled = chophep;
        }

        private void f_loadcontrol_thongtintd(long idql, string ngaygio, int iddoituong, decimal idphong, string mach, string nhietdo, string huyetap, string cannang, int stt, string lydokham)
        {
            this.datengaygio.Tag = idql;
            try
            {
                this.datengaygio.EditValue = new DateTime(int.Parse(ngaygio.Substring(6, 4)), int.Parse(ngaygio.Substring(3, 2)), int.Parse(ngaygio.Substring(0, 2)), int.Parse(ngaygio.Substring(11, 2)), int.Parse(ngaygio.Substring(14, 2)), 0);
            }
            catch
            {
            }
            this.txtmach.Text = mach;
            this.txtnhietdo.Text = nhietdo;
            this.txthuyetap.Text = huyetap;
            this.txtcannang.Text = cannang;
            this.txtstt.Text = stt.ToString();
            this.txtlydokham.Text = lydokham;
        }

        private void f_loaddata_danhsachbn()
        {
            this.ctrdanhsach_bn.SetDataSource = new dtoBNThongTinBN(this._xuli.pConFigData).LoadAll();
            this.ctrdanhsach_bn.DanhSachCotHienThi = "mabn,hoten,phai,namsinh,diachi";
        }

        private void f_SetControl_benhnhan(string mabn)
        {
            try
            {
                dtoBNThongTinBN nbn = new dtoBNThongTinBN(this._xuli.pConFigData) {
                    MABN = mabn
                };
                nbn.Load();
                this.f_loadcontrol_benhnhan(nbn.MABN, nbn.HOTEN, nbn.IDGIOITINH, nbn.NGAYSINH, nbn.NAMSINH.ToString(), nbn.DIACHI, nbn.DIENTHOAI, nbn.IDPHUONGXA);
            }
            catch
            {
                this.f_loadcontrol_benhnhan("", "", 0, "", "", "", "", 0L);
            }
        }

        private void f_setcontrol_phuongxa(string maphuongxa, long idphuongxa)
        {
            try
            {
                DataTable table = new BNDanhMuc(this._xuli.pConFigData).f_loaddata_tinhphuongxa(maphuongxa, idphuongxa);
                this.txttenphuongxa.Text = table.Rows[0]["ten"].ToString();
                this.txttenphuongxa.Tag = table.Rows[0]["idtinhthanh"].ToString() + "^" + table.Rows[0]["idquanhuyen"].ToString() + "^" + table.Rows[0]["idphuongxa"].ToString();
                this.txtmaphuongxa.Tag = table.Rows[0]["id"].ToString();
                this.txtmaphuongxa.Text = table.Rows[0]["viettat"].ToString();
            }
            catch
            {
                this.txttenphuongxa.Text = "";
                this.txtmaphuongxa.Tag = 0;
                this.txtmaphuongxa.Text = "";
            }
        }

        private void f_tinh_tuoi()
        {
            try
            {
                DateTime now = DateTime.Now;
                if (this.txtngaysinh.Text != "")
                {
                    try
                    {
                        now = this._objtiepdon.f_tinh_ngaytuoi(this.txtngaysinh.Text, 0, 0, 0);
                    }
                    catch
                    {
                    }
                }
                if (this.txtnamsinh.Text == "")
                {
                    this.txtnamsinh.Text = now.Year.ToString();
                }
                if ((this.txttuoi.Text == "") || (this.txttuoi.Text == "0"))
                {
                    int num = DateTime.Now.Year - int.Parse(this.txtnamsinh.Text);
                    if (num > 0)
                    {
                        this.txttuoi.Text =string.Concat(num + 1);
                        this.lkploaituoi.EditValue = HangSo.LoaiTuoi.pTuoi;
                    }
                    else if (this.txtngaysinh.Text != "")
                    {
                        while (string.Compare(now.ToString("yyyyMM"), DateTime.Now.ToString("yyyyMM")) < 1)
                        {
                            num++;
                        }
                        this.txttuoi.Text = num.ToString();
                        this.lkploaituoi.EditValue = HangSo.LoaiTuoi.pThang;
                    }
                    this.txttuoi.Focus();
                }
            }
            catch
            {
            }
        }

        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(ucbn_tiepdon));
            this.label1 = new Label();
            this.label2 = new Label();
            this.txthoten = new TextEdit();
            this.label3 = new Label();
            this.txtdiachi = new TextEdit();
            this.label4 = new Label();
            this.sbtntieptheo = new SimpleButton();
            this.sbtnluu = new SimpleButton();
            this.sbtnboqua = new SimpleButton();
            this.sbtnketthuc = new SimpleButton();
            this.label5 = new Label();
            this.txtdienthoai = new TextEdit();
            this.label6 = new Label();
            this.label7 = new Label();
            this.txtnamsinh = new TextEdit();
            this.label8 = new Label();
            this.txttuoi = new TextEdit();
            this.groupControl1 = new GroupControl();
            this.ctrdanhsach_bn = new ctrdanhsach();
            this.txtngaysinh = new MaskedTextBox();
            this.txtmaphuongxa = new TextEdit();
            this.txttenphuongxa = new TextEdit();
            this.label30 = new Label();
            this.lkploaituoi = new LookUpEdit();
            this.rdbnu = new RadioButton();
            this.rdbnam = new RadioButton();
            this.txtmabn2 = new TextEdit();
            this.groupControl2 = new GroupControl();
            this.lkephong = new LookUpEdit();
            this.txtcannang = new TextEdit();
            this.txthuyetap = new TextEdit();
            this.txtnhietdo = new TextEdit();
            this.txtlydokham = new TextEdit();
            this.txtstt = new TextEdit();
            this.txtmach = new TextEdit();
            this.datengaygio = new DateEdit();
            this.label19 = new Label();
            this.label20 = new Label();
            this.label21 = new Label();
            this.label18 = new Label();
            this.label24 = new Label();
            this.label16 = new Label();
            this.label23 = new Label();
            this.label22 = new Label();
            this.label17 = new Label();
            this.label15 = new Label();
            this.label12 = new Label();
            this.label14 = new Label();
            this.groupControl3 = new GroupControl();
            this.tldk = new TreeList();
            this.tldk_ten = new TreeListColumn();
            this.repositoryItemTextEdit1 = new RepositoryItemTextEdit();
            this.tldk_idql = new TreeListColumn();
            this.sbtnchidinh = new SimpleButton();
            this.sbtnsua = new SimpleButton();
            this.btntimbn = new SimpleButton();
            this.txthoten.Properties.BeginInit();
            this.txtdiachi.Properties.BeginInit();
            this.txtdienthoai.Properties.BeginInit();
            this.txtnamsinh.Properties.BeginInit();
            this.txttuoi.Properties.BeginInit();
            this.groupControl1.BeginInit();
            this.groupControl1.SuspendLayout();
            this.txtmaphuongxa.Properties.BeginInit();
            this.txttenphuongxa.Properties.BeginInit();
            this.lkploaituoi.Properties.BeginInit();
            this.txtmabn2.Properties.BeginInit();
            this.groupControl2.BeginInit();
            this.groupControl2.SuspendLayout();
            this.lkephong.Properties.BeginInit();
            this.txtcannang.Properties.BeginInit();
            this.txthuyetap.Properties.BeginInit();
            this.txtnhietdo.Properties.BeginInit();
            this.txtlydokham.Properties.BeginInit();
            this.txtstt.Properties.BeginInit();
            this.txtmach.Properties.BeginInit();
            this.datengaygio.Properties.VistaTimeProperties.BeginInit();
            this.datengaygio.Properties.BeginInit();
            this.groupControl3.BeginInit();
            this.groupControl3.SuspendLayout();
            this.tldk.BeginInit();
            this.repositoryItemTextEdit1.BeginInit();
            base.SuspendLayout();
            this.label1.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label1.Location = new Point(0x18, 0x1f);
            this.label1.Name = "label1";
            this.label1.Size = new Size(0x43, 0x17);
            this.label1.TabIndex = 0;
            this.label1.Text = "M\x00e3 BN:";
            this.label1.TextAlign = ContentAlignment.MiddleRight;
            this.label2.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label2.Location = new Point(180, 0x1f);
            this.label2.Name = "label2";
            this.label2.Size = new Size(0x5b, 0x17);
            this.label2.TabIndex = 0;
            this.label2.Text = "Họ v\x00e0 t\x00ean:";
            this.label2.TextAlign = ContentAlignment.MiddleRight;
            this.txthoten.Location = new Point(0x10c, 0x1f);
            this.txthoten.Name = "txthoten";
            this.txthoten.Properties.Appearance.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.txthoten.Properties.Appearance.Options.UseFont = true;
            this.txthoten.Properties.CharacterCasing = CharacterCasing.Upper;
            this.txthoten.Size = new Size(380, 0x16);
            this.txthoten.TabIndex = 1;
            this.txthoten.TextChanged += new EventHandler(this.txthoten_TextChanged);
            this.txthoten.Enter += new EventHandler(this.txthoten_Enter);
            this.txthoten.KeyDown += new KeyEventHandler(this.txthoten_KeyDown);
            this.label3.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label3.Location = new Point(5, 0x56);
            this.label3.Name = "label3";
            this.label3.Size = new Size(0x56, 0x18);
            this.label3.TabIndex = 0;
            this.label3.Text = "Địa chỉ:";
            this.label3.TextAlign = ContentAlignment.MiddleRight;
            this.txtdiachi.Location = new Point(0x56, 0x58);
            this.txtdiachi.Name = "txtdiachi";
            this.txtdiachi.Properties.Appearance.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.txtdiachi.Properties.Appearance.Options.UseFont = true;
            this.txtdiachi.Size = new Size(0x10c, 0x16);
            this.txtdiachi.TabIndex = 8;
            this.txtdiachi.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.label4.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label4.Location = new Point(0x15, 0x39);
            this.label4.Name = "label4";
            this.label4.Size = new Size(0x47, 0x18);
            this.label4.TabIndex = 0;
            this.label4.Text = "Giới t\x00ednh:";
            this.label4.TextAlign = ContentAlignment.MiddleRight;
            this.sbtntieptheo.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.sbtntieptheo.Appearance.Font = new Font("Tahoma", 10f);
            this.sbtntieptheo.Appearance.Options.UseFont = true;
            //this.sbtntieptheo.Image = (Image) manager.GetObject("sbtntieptheo.Image");
            this.sbtntieptheo.ImageLocation = ImageLocation.MiddleLeft;
            this.sbtntieptheo.Location = new Point(4, 0x119);
            this.sbtntieptheo.Name = "sbtntieptheo";
            this.sbtntieptheo.Size = new Size(0x73, 0x17);
            this.sbtntieptheo.TabIndex = 3;
            this.sbtntieptheo.Text = "&Tiếp theo [F2]";
            this.sbtntieptheo.Click += new EventHandler(this.stbntieptheo_Click);
            this.sbtnluu.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.sbtnluu.Appearance.Font = new Font("Tahoma", 10f);
            this.sbtnluu.Appearance.Options.UseFont = true;
            this.sbtnluu.Image = Properties.Resources.imgsave;// (Image)manager.GetObject("sbtnluu.Image");
            this.sbtnluu.Location = new Point(0x7a, 0x119);
            this.sbtnluu.Name = "sbtnluu";
            this.sbtnluu.Size = new Size(80, 0x17);
            this.sbtnluu.TabIndex = 2;
            this.sbtnluu.Text = " &Lưu [F5]";
            this.sbtnluu.Click += new EventHandler(this.sbtnluu_Click);
            this.sbtnboqua.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.sbtnboqua.Appearance.Font = new Font("Tahoma", 10f);
            this.sbtnboqua.Appearance.Options.UseFont = true;
            this.sbtnboqua.Image = (Image) manager.GetObject("sbtnboqua.Image");
            this.sbtnboqua.Location = new Point(0x123, 0x119);
            this.sbtnboqua.Name = "sbtnboqua";
            this.sbtnboqua.Size = new Size(0x5c, 0x17);
            this.sbtnboqua.TabIndex = 5;
            this.sbtnboqua.Text = "&Bỏ qua [F4]";
            this.sbtnboqua.Click += new EventHandler(this.sbtnboqua_Click);
            this.sbtnketthuc.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
            this.sbtnketthuc.Appearance.Font = new Font("Tahoma", 10f);
            this.sbtnketthuc.Appearance.Options.UseFont = true;
            this.sbtnketthuc.Image = (Image) manager.GetObject("sbtnketthuc.Image");
            this.sbtnketthuc.ImeMode = ImeMode.NoControl;
            this.sbtnketthuc.Location = new Point(0x326, 0x119);
            this.sbtnketthuc.Name = "sbtnketthuc";
            this.sbtnketthuc.Size = new Size(130, 0x17);
            this.sbtnketthuc.TabIndex = 7;
            this.sbtnketthuc.Text = "&Kết th\x00fac [F12]";
            this.sbtnketthuc.Click += new EventHandler(this.stbnketthuc_Click);
            this.label5.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label5.Location = new Point(0x165, 0x56);
            this.label5.Name = "label5";
            this.label5.Size = new Size(0x58, 0x19);
            this.label5.TabIndex = 0;
            this.label5.Text = "Điện thoại:";
            this.label5.TextAlign = ContentAlignment.MiddleRight;
            this.txtdienthoai.Location = new Point(0x1ba, 0x57);
            this.txtdienthoai.Name = "txtdienthoai";
            this.txtdienthoai.Properties.Appearance.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.txtdienthoai.Properties.Appearance.Options.UseFont = true;
            this.txtdienthoai.Size = new Size(0xce, 0x16);
            this.txtdienthoai.TabIndex = 9;
            this.txtdienthoai.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.label6.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label6.Location = new Point(180, 0x3b);
            this.label6.Name = "label6";
            this.label6.Size = new Size(0x5b, 0x16);
            this.label6.TabIndex = 6;
            this.label6.Text = "Ng\x00e0y sinh:";
            this.label6.TextAlign = ContentAlignment.MiddleRight;
            this.label7.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label7.Location = new Point(0x162, 0x3b);
            this.label7.Name = "label7";
            this.label7.Size = new Size(0x5b, 0x16);
            this.label7.TabIndex = 0;
            this.label7.Text = "Năm sinh:";
            this.label7.TextAlign = ContentAlignment.MiddleRight;
            this.txtnamsinh.Location = new Point(0x1ba, 0x3b);
            this.txtnamsinh.Name = "txtnamsinh";
            this.txtnamsinh.Properties.Appearance.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.txtnamsinh.Properties.Appearance.Options.UseFont = true;
            this.txtnamsinh.Properties.CharacterCasing = CharacterCasing.Upper;
            this.txtnamsinh.Properties.MaxLength = 4;
            this.txtnamsinh.Size = new Size(0x2c, 0x16);
            this.txtnamsinh.TabIndex = 5;
            this.txtnamsinh.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.txtnamsinh.Validated += new EventHandler(this.txtnamsinh_Validated);
            this.label8.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label8.Location = new Point(0x1e3, 0x3b);
            this.label8.Name = "label8";
            this.label8.Size = new Size(0x2e, 0x16);
            this.label8.TabIndex = 0;
            this.label8.Text = "Tuổi:";
            this.label8.TextAlign = ContentAlignment.MiddleRight;
            this.txttuoi.Location = new Point(0x20c, 0x3b);
            this.txttuoi.Name = "txttuoi";
            this.txttuoi.Properties.Appearance.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.txttuoi.Properties.Appearance.Options.UseFont = true;
            this.txttuoi.Properties.CharacterCasing = CharacterCasing.Upper;
            this.txttuoi.Size = new Size(0x1b, 0x16);
            this.txttuoi.TabIndex = 6;
            this.txttuoi.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.txttuoi.Validated += new EventHandler(this.txttuoi_Validated);
            this.groupControl1.Appearance.Font = new Font("Tahoma", 10f);
            this.groupControl1.Appearance.Options.UseFont = true;
            this.groupControl1.AppearanceCaption.BackColor = Color.FromArgb(0xe3, 0xef, 0xff);
            this.groupControl1.AppearanceCaption.Font = new Font("Tahoma", 12f, FontStyle.Bold);
            this.groupControl1.AppearanceCaption.Options.UseBackColor = true;
            this.groupControl1.AppearanceCaption.Options.UseFont = true;
            this.groupControl1.Controls.Add(this.btntimbn);
            this.groupControl1.Controls.Add(this.ctrdanhsach_bn);
            this.groupControl1.Controls.Add(this.txtngaysinh);
            this.groupControl1.Controls.Add(this.txtmaphuongxa);
            this.groupControl1.Controls.Add(this.txttenphuongxa);
            this.groupControl1.Controls.Add(this.label30);
            this.groupControl1.Controls.Add(this.lkploaituoi);
            this.groupControl1.Controls.Add(this.rdbnu);
            this.groupControl1.Controls.Add(this.rdbnam);
            this.groupControl1.Controls.Add(this.txthoten);
            this.groupControl1.Controls.Add(this.label6);
            this.groupControl1.Controls.Add(this.label4);
            this.groupControl1.Controls.Add(this.txtdienthoai);
            this.groupControl1.Controls.Add(this.txtmabn2);
            this.groupControl1.Controls.Add(this.txtdiachi);
            this.groupControl1.Controls.Add(this.txtnamsinh);
            this.groupControl1.Controls.Add(this.txttuoi);
            this.groupControl1.Controls.Add(this.label3);
            this.groupControl1.Controls.Add(this.label2);
            this.groupControl1.Controls.Add(this.label5);
            this.groupControl1.Controls.Add(this.label7);
            this.groupControl1.Controls.Add(this.label8);
            this.groupControl1.Controls.Add(this.label1);
            this.groupControl1.Location = new Point(3, 12);
            this.groupControl1.Name = "groupControl1";
            this.groupControl1.Size = new Size(0x28c, 0x92);
            this.groupControl1.TabIndex = 0;
            this.groupControl1.Text = "Th\x00f4ng tin h\x00e0nh ch\x00ednh";
            this.ctrdanhsach_bn.ChieuRongTuDong = true;
            this.ctrdanhsach_bn.DanhSachCotHienThi = "";
            this.ctrdanhsach_bn.DanhSachCotHienThi_kt = "";
            this.ctrdanhsach_bn.Location = new Point(8, 0x49);
            this.ctrdanhsach_bn.Name = "ctrdanhsach_bn";
            this.ctrdanhsach_bn.pRowsCountDown = 5;
            this.ctrdanhsach_bn.Size = new Size(0x31, 0x13);
            this.ctrdanhsach_bn.TabIndex = 2;
            this.ctrdanhsach_bn.Visible = false;
            this.ctrdanhsach_bn.Validated += new EventHandler(this.ctrdanhsach_bn_Validated);
            this.txtngaysinh.Font = new Font("Tahoma", 10f);
            this.txtngaysinh.Location = new Point(0x10c, 0x39);
            this.txtngaysinh.Mask = "00/00/0000";
            this.txtngaysinh.Name = "txtngaysinh";
            this.txtngaysinh.Size = new Size(0x56, 0x18);
            this.txtngaysinh.TabIndex = 4;
            this.txtngaysinh.ValidatingType = typeof(DateTime);
            this.txtngaysinh.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.txtngaysinh.Validated += new EventHandler(this.txtngaysinh_Validated);
            this.txtmaphuongxa.Location = new Point(0x56, 0x74);
            this.txtmaphuongxa.Name = "txtmaphuongxa";
            this.txtmaphuongxa.Properties.Appearance.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.txtmaphuongxa.Properties.Appearance.Options.UseFont = true;
            this.txtmaphuongxa.Properties.CharacterCasing = CharacterCasing.Upper;
            this.txtmaphuongxa.Size = new Size(0x5f, 0x16);
            this.txtmaphuongxa.TabIndex = 10;
            this.txtmaphuongxa.ToolTipTitle = "M\x00e3 viết tắt";
            this.txtmaphuongxa.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.txtmaphuongxa.Validated += new EventHandler(this.txtmaphuongxa_Validated);
            this.txttenphuongxa.Location = new Point(0xb7, 0x74);
            this.txttenphuongxa.Name = "txttenphuongxa";
            this.txttenphuongxa.Properties.Appearance.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.txttenphuongxa.Properties.Appearance.Options.UseFont = true;
            this.txttenphuongxa.Size = new Size(0x1d1, 0x16);
            this.txttenphuongxa.TabIndex = 11;
            this.txttenphuongxa.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.label30.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label30.Location = new Point(0x20, 0x72);
            this.label30.Name = "label30";
            this.label30.Size = new Size(0x31, 0x16);
            this.label30.TabIndex = 0x17;
            this.label30.Text = "T/P/X:";
            this.label30.TextAlign = ContentAlignment.MiddleRight;
            this.lkploaituoi.Location = new Point(0x228, 0x3b);
            this.lkploaituoi.Name = "lkploaituoi";
            this.lkploaituoi.Properties.Appearance.Font = new Font("Tahoma", 10f);
            this.lkploaituoi.Properties.Appearance.Options.UseFont = true;
            this.lkploaituoi.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.lkploaituoi.Properties.Columns.AddRange(new LookUpColumnInfo[] { new LookUpColumnInfo("id", "id", 20, FormatType.None, "", false, HorzAlignment.Default), new LookUpColumnInfo("ten", "Tuổi") });
            this.lkploaituoi.Properties.NullText = "";
            this.lkploaituoi.Size = new Size(0x60, 0x16);
            this.lkploaituoi.TabIndex = 7;
            this.lkploaituoi.EditValueChanged += new EventHandler(this.lkploaituoi_EditValueChanged);
            this.lkploaituoi.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.rdbnu.AutoSize = true;
            this.rdbnu.Font = new Font("Tahoma", 10f);
            this.rdbnu.Location = new Point(0x91, 60);
            this.rdbnu.Name = "rdbnu";
            this.rdbnu.Size = new Size(0x2c, 0x15);
            this.rdbnu.TabIndex = 3;
            this.rdbnu.Text = "Nữ";
            this.rdbnu.UseVisualStyleBackColor = true;
            this.rdbnu.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.rdbnam.AutoSize = true;
            this.rdbnam.Checked = true;
            this.rdbnam.Font = new Font("Tahoma", 10f);
            this.rdbnam.Location = new Point(0x59, 0x3b);
            this.rdbnam.Name = "rdbnam";
            this.rdbnam.Size = new Size(0x36, 0x15);
            this.rdbnam.TabIndex = 2;
            this.rdbnam.TabStop = true;
            this.rdbnam.Text = "Nam";
            this.rdbnam.UseVisualStyleBackColor = true;
            this.rdbnam.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.txtmabn2.Location = new Point(0x56, 0x1f);
            this.txtmabn2.Name = "txtmabn2";
            this.txtmabn2.Properties.Appearance.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.txtmabn2.Properties.Appearance.Options.UseFont = true;
            this.txtmabn2.Properties.MaxLength = 10;
            this.txtmabn2.Size = new Size(0x5f, 0x16);
            this.txtmabn2.TabIndex = 0;
            this.txtmabn2.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.txtmabn2.Validated += new EventHandler(this.txtmabn2_Validated);
            this.groupControl2.AppearanceCaption.Font = new Font("Tahoma", 12f, FontStyle.Bold);
            this.groupControl2.AppearanceCaption.Options.UseFont = true;
            this.groupControl2.Controls.Add(this.lkephong);
            this.groupControl2.Controls.Add(this.txtcannang);
            this.groupControl2.Controls.Add(this.txthuyetap);
            this.groupControl2.Controls.Add(this.txtnhietdo);
            this.groupControl2.Controls.Add(this.txtlydokham);
            this.groupControl2.Controls.Add(this.txtstt);
            this.groupControl2.Controls.Add(this.txtmach);
            this.groupControl2.Controls.Add(this.datengaygio);
            this.groupControl2.Controls.Add(this.label19);
            this.groupControl2.Controls.Add(this.label20);
            this.groupControl2.Controls.Add(this.label21);
            this.groupControl2.Controls.Add(this.label18);
            this.groupControl2.Controls.Add(this.label24);
            this.groupControl2.Controls.Add(this.label16);
            this.groupControl2.Controls.Add(this.label23);
            this.groupControl2.Controls.Add(this.label22);
            this.groupControl2.Controls.Add(this.label17);
            this.groupControl2.Controls.Add(this.label15);
            this.groupControl2.Controls.Add(this.label12);
            this.groupControl2.Controls.Add(this.label14);
            this.groupControl2.Location = new Point(3, 0x9f);
            this.groupControl2.Name = "groupControl2";
            this.groupControl2.Size = new Size(0x28c, 0x74);
            this.groupControl2.TabIndex = 1;
            this.groupControl2.Text = "Th\x00f4ng tin đăng k\x00fd kh\x00e1m bệnh";
            this.lkephong.Location = new Point(0x11d, 0x1d);
            this.lkephong.Name = "lkephong";
            this.lkephong.Properties.Appearance.Font = new Font("Tahoma", 10f);
            this.lkephong.Properties.Appearance.Options.UseFont = true;
            this.lkephong.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.lkephong.Properties.Columns.AddRange(new LookUpColumnInfo[] { new LookUpColumnInfo("id", "id", 20, FormatType.None, "", false, HorzAlignment.Default), new LookUpColumnInfo("ten", "T\x00ean") });
            this.lkephong.Properties.NullText = "";
            this.lkephong.Size = new Size(0x16b, 0x16);
            this.lkephong.TabIndex = 1;
            this.lkephong.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.txtcannang.Location = new Point(0x254, 60);
            this.txtcannang.Name = "txtcannang";
            this.txtcannang.Properties.Appearance.Font = new Font("Tahoma", 10f);
            this.txtcannang.Properties.Appearance.Options.UseFont = true;
            this.txtcannang.Size = new Size(0x16, 0x16);
            this.txtcannang.TabIndex = 5;
            this.txtcannang.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.txthuyetap.Location = new Point(0x1ba, 60);
            this.txthuyetap.Name = "txthuyetap";
            this.txthuyetap.Properties.Appearance.Font = new Font("Tahoma", 10f);
            this.txthuyetap.Properties.Appearance.Options.UseFont = true;
            this.txthuyetap.Size = new Size(60, 0x16);
            this.txthuyetap.TabIndex = 4;
            this.txthuyetap.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.txtnhietdo.Location = new Point(0x11d, 60);
            this.txtnhietdo.Name = "txtnhietdo";
            this.txtnhietdo.Properties.Appearance.Font = new Font("Tahoma", 10f);
            this.txtnhietdo.Properties.Appearance.Options.UseFont = true;
            this.txtnhietdo.Size = new Size(0x27, 0x16);
            this.txtnhietdo.TabIndex = 3;
            this.txtnhietdo.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.txtlydokham.EditValue = "";
            this.txtlydokham.Location = new Point(0xdb, 0x58);
            this.txtlydokham.Name = "txtlydokham";
            this.txtlydokham.Properties.Appearance.Font = new Font("Tahoma", 10f);
            this.txtlydokham.Properties.Appearance.Options.UseFont = true;
            this.txtlydokham.Size = new Size(0x1ad, 0x16);
            this.txtlydokham.TabIndex = 7;
            this.txtlydokham.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.txtstt.EditValue = "0";
            this.txtstt.Location = new Point(0x58, 0x59);
            this.txtstt.Name = "txtstt";
            this.txtstt.Properties.Appearance.Font = new Font("Tahoma", 10f);
            this.txtstt.Properties.Appearance.Options.UseFont = true;
            this.txtstt.Properties.DisplayFormat.FormatType = FormatType.Numeric;
            this.txtstt.Properties.EditFormat.FormatType = FormatType.Numeric;
            this.txtstt.Properties.ExportMode = ExportMode.DisplayText;
            this.txtstt.Properties.Mask.EditMask = @"\d+";
            this.txtstt.Properties.Mask.MaskType = MaskType.RegEx;
            this.txtstt.Size = new Size(0x2f, 0x16);
            this.txtstt.TabIndex = 6;
            this.txtstt.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.txtmach.Location = new Point(0x58, 60);
            this.txtmach.Name = "txtmach";
            this.txtmach.Properties.Appearance.Font = new Font("Tahoma", 10f);
            this.txtmach.Properties.Appearance.Options.UseFont = true;
            this.txtmach.Size = new Size(0x2f, 0x16);
            this.txtmach.TabIndex = 2;
            this.txtmach.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.datengaygio.EditValue = new DateTime(0x7dd, 9, 15, 2, 20, 5, 0x13f);
            this.datengaygio.Location = new Point(0x58, 0x1f);
            this.datengaygio.Name = "datengaygio";
            this.datengaygio.Properties.Appearance.Font = new Font("Tahoma", 10f);
            this.datengaygio.Properties.Appearance.Options.UseFont = true;
            this.datengaygio.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.datengaygio.Properties.DisplayFormat.FormatString = "dd/MM/yyyy HH:mm";
            this.datengaygio.Properties.DisplayFormat.FormatType = FormatType.DateTime;
            this.datengaygio.Properties.EditFormat.FormatString = "dd/MM/yyyy HH:mm";
            this.datengaygio.Properties.EditFormat.FormatType = FormatType.DateTime;
            this.datengaygio.Properties.Mask.EditMask = "dd/MM/yyyy HH:mm";
            this.datengaygio.Properties.VistaTimeProperties.Buttons.AddRange(new EditorButton[] { new EditorButton() });
            this.datengaygio.Size = new Size(0x7f, 20);
            this.datengaygio.TabIndex = 0;
            this.datengaygio.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.label19.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label19.Location = new Point(0x225, 60);
            this.label19.Name = "label19";
            this.label19.Size = new Size(50, 0x17);
            this.label19.TabIndex = 0;
            this.label19.Text = "Nặng:";
            this.label19.TextAlign = ContentAlignment.MiddleRight;
            this.label20.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label20.Location = new Point(0x269, 60);
            this.label20.Name = "label20";
            this.label20.Size = new Size(0x17, 0x17);
            this.label20.TabIndex = 0;
            this.label20.Text = "kg";
            this.label20.TextAlign = ContentAlignment.MiddleLeft;
            this.label21.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label21.Location = new Point(0x1f7, 60);
            this.label21.Name = "label21";
            this.label21.Size = new Size(0x33, 0x17);
            this.label21.TabIndex = 0;
            this.label21.Text = "mmHg";
            this.label21.TextAlign = ContentAlignment.MiddleLeft;
            this.label18.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label18.Location = new Point(0x176, 60);
            this.label18.Name = "label18";
            this.label18.Size = new Size(0x45, 0x17);
            this.label18.TabIndex = 0;
            this.label18.Text = "Huyết \x00e1p:";
            this.label18.TextAlign = ContentAlignment.MiddleRight;
            this.label24.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Bold, GraphicsUnit.Point, 0);
            this.label24.Location = new Point(0x145, 0x3b);
            this.label24.Name = "label24";
            this.label24.Size = new Size(0x1a, 0x17);
            this.label24.TabIndex = 0;
            this.label24.Text = "\x00b0C";
            this.label24.TextAlign = ContentAlignment.MiddleLeft;
            this.label16.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label16.Location = new Point(0xd8, 60);
            this.label16.Name = "label16";
            this.label16.Size = new Size(0x45, 0x17);
            this.label16.TabIndex = 0;
            this.label16.Text = "Nhiệt độ:";
            this.label16.TextAlign = ContentAlignment.MiddleRight;
            this.label23.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label23.Location = new Point(0x7b, 0x58);
            this.label23.Name = "label23";
            this.label23.Size = new Size(0x63, 0x17);
            this.label23.TabIndex = 0;
            this.label23.Text = "L\x00fd do kh\x00e1m:";
            this.label23.TextAlign = ContentAlignment.MiddleRight;
            this.label22.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label22.Location = new Point(0x29, 0x58);
            this.label22.Name = "label22";
            this.label22.Size = new Size(0x2f, 0x17);
            this.label22.TabIndex = 0;
            this.label22.Text = "STT:";
            this.label22.TextAlign = ContentAlignment.MiddleRight;
            this.label17.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label17.Location = new Point(0x87, 60);
            this.label17.Name = "label17";
            this.label17.Size = new Size(0x3f, 0x17);
            this.label17.TabIndex = 0;
            this.label17.Text = "lần/ph\x00fat";
            this.label17.TextAlign = ContentAlignment.MiddleLeft;
            this.label15.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label15.Location = new Point(5, 60);
            this.label15.Name = "label15";
            this.label15.Size = new Size(0x56, 0x17);
            this.label15.TabIndex = 0;
            this.label15.Text = "Mạch:";
            this.label15.TextAlign = ContentAlignment.MiddleRight;
            this.label12.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label12.Location = new Point(5, 0x1f);
            this.label12.Name = "label12";
            this.label12.Size = new Size(0x56, 0x17);
            this.label12.TabIndex = 0;
            this.label12.Text = "Ng\x00e0y giờ:";
            this.label12.TextAlign = ContentAlignment.MiddleRight;
            this.label14.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label14.Location = new Point(0xd5, 0x1d);
            this.label14.Name = "label14";
            this.label14.Size = new Size(0x4b, 0x17);
            this.label14.TabIndex = 7;
            this.label14.Text = "K/Ph\x00f2ng:";
            this.label14.TextAlign = ContentAlignment.MiddleRight;
            this.groupControl3.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.groupControl3.AppearanceCaption.Font = new Font("Tahoma", 12f, FontStyle.Bold);
            this.groupControl3.AppearanceCaption.Options.UseFont = true;
            this.groupControl3.Controls.Add(this.tldk);
            this.groupControl3.Controls.Add(this.sbtnchidinh);
            this.groupControl3.Location = new Point(0x291, 12);
            this.groupControl3.Name = "groupControl3";
            this.groupControl3.Size = new Size(0x119, 0x107);
            this.groupControl3.TabIndex = 6;
            this.groupControl3.Text = "C\x00e1c lần đăng k\x00fd";
            this.tldk.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
            this.tldk.Columns.AddRange(new TreeListColumn[] { this.tldk_ten, this.tldk_idql });
            this.tldk.Location = new Point(2, 0x1c);
            this.tldk.Name = "tldk";
            this.tldk.RepositoryItems.AddRange(new RepositoryItem[] { this.repositoryItemTextEdit1 });
            this.tldk.Size = new Size(0x115, 0xc7);
            this.tldk.TabIndex = 0;
            this.tldk.FocusedNodeChanged += new FocusedNodeChangedEventHandler(this.tldk_FocusedNodeChanged);
            this.tldk.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.tldk_ten.Caption = "Ng\x00e0y";
            this.tldk_ten.ColumnEdit = this.repositoryItemTextEdit1;
            this.tldk_ten.FieldName = "ngay";
            this.tldk_ten.Name = "tldk_ten";
            this.tldk_ten.OptionsColumn.AllowEdit = false;
            this.tldk_ten.Visible = true;
            this.tldk_ten.VisibleIndex = 0;
            this.repositoryItemTextEdit1.AutoHeight = false;
            this.repositoryItemTextEdit1.Name = "repositoryItemTextEdit1";
            this.repositoryItemTextEdit1.ReadOnly = true;
            this.tldk_idql.Caption = "idql";
            this.tldk_idql.ColumnEdit = this.repositoryItemTextEdit1;
            this.tldk_idql.FieldName = "idql";
            this.tldk_idql.Name = "tldk_idql";
            this.tldk_idql.OptionsColumn.AllowEdit = false;
            this.sbtnchidinh.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom;
            this.sbtnchidinh.Appearance.Font = new Font("Tahoma", 10f);
            this.sbtnchidinh.Appearance.Options.UseFont = true;
            this.sbtnchidinh.Appearance.Options.UseTextOptions = true;
            this.sbtnchidinh.Appearance.TextOptions.HAlignment = HorzAlignment.Near;
            this.sbtnchidinh.Location = new Point(0, 0xe7);
            this.sbtnchidinh.Name = "sbtnchidinh";
            this.sbtnchidinh.Size = new Size(0x115, 0x17);
            this.sbtnchidinh.TabIndex = 5;
            this.sbtnchidinh.Text = "&Chỉ định dịch vụ [F7]";
            this.sbtnchidinh.Click += new EventHandler(this.sbtnchidinh_Click);
            this.sbtnsua.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.sbtnsua.Appearance.Font = new Font("Tahoma", 10f);
            this.sbtnsua.Appearance.Options.UseFont = true;
            this.sbtnsua.Image = (Image) manager.GetObject("sbtnsua.Image");
            this.sbtnsua.Location = new Point(0xcd, 0x119);
            this.sbtnsua.Name = "sbtnsua";
            this.sbtnsua.Size = new Size(0x52, 0x17);
            this.sbtnsua.TabIndex = 4;
            this.sbtnsua.Text = "&Sửa [F3]";
            this.sbtnsua.Click += new EventHandler(this.sbtnsua_Click);
            this.btntimbn.Appearance.Font = new Font("Tahoma", 10f);
            this.btntimbn.Appearance.Options.UseFont = true;
            this.btntimbn.Image = (Image) manager.GetObject("btntimbn.Image");
            this.btntimbn.Location = new Point(10, 30);
            this.btntimbn.Name = "btntimbn";
            this.btntimbn.Size = new Size(0x16, 0x17);
            this.btntimbn.TabIndex = 0x18;
            this.btntimbn.ToolTip = "T\x00ecm th\x00f4ng tin bệnh nh\x00e2n";
            this.btntimbn.Click += new EventHandler(this.btntimbn_Click);
            base.AutoScaleMode = AutoScaleMode.None;
            base.Controls.Add(this.groupControl3);
            base.Controls.Add(this.groupControl2);
            base.Controls.Add(this.groupControl1);
            base.Controls.Add(this.sbtnketthuc);
            base.Controls.Add(this.sbtnsua);
            base.Controls.Add(this.sbtnboqua);
            base.Controls.Add(this.sbtnluu);
            base.Controls.Add(this.sbtntieptheo);
            this.LookAndFeel.SkinName = "Blue";
            base.Name = "ucbn_tiepdon";
            base.Size = new Size(0x3ab, 0x137);
            base.Load += new EventHandler(this.ucbn_tiepdon_Load);
            base.ControlRemoved += new ControlEventHandler(this.ucbn_tiepdon_ControlRemoved);
            base.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.txthoten.Properties.EndInit();
            this.txtdiachi.Properties.EndInit();
            this.txtdienthoai.Properties.EndInit();
            this.txtnamsinh.Properties.EndInit();
            this.txttuoi.Properties.EndInit();
            this.groupControl1.EndInit();
            this.groupControl1.ResumeLayout(false);
            this.groupControl1.PerformLayout();
            this.txtmaphuongxa.Properties.EndInit();
            this.txttenphuongxa.Properties.EndInit();
            this.lkploaituoi.Properties.EndInit();
            this.txtmabn2.Properties.EndInit();
            this.groupControl2.EndInit();
            this.groupControl2.ResumeLayout(false);
            this.lkephong.Properties.EndInit();
            this.txtcannang.Properties.EndInit();
            this.txthuyetap.Properties.EndInit();
            this.txtnhietdo.Properties.EndInit();
            this.txtlydokham.Properties.EndInit();
            this.txtstt.Properties.EndInit();
            this.txtmach.Properties.EndInit();
            this.datengaygio.Properties.VistaTimeProperties.EndInit();
            this.datengaygio.Properties.EndInit();
            this.groupControl3.EndInit();
            this.groupControl3.ResumeLayout(false);
            this.tldk.EndInit();
            this.repositoryItemTextEdit1.EndInit();
            base.ResumeLayout(false);
        }

        private void lkploaituoi_EditValueChanged(object sender, EventArgs e)
        {
            this.txttuoi_Validated(sender, e);
        }

        private void sbtnboqua_Click(object sender, EventArgs e)
        {
            this.f_loadcontrol_chophepsua(false);
        }

        private void sbtnchidinh_Click(object sender, EventArgs e)
        {
            ucbn_chidinh _chidinh = new ucbn_chidinh(this._xuli, long.Parse(this.datengaygio.Tag.ToString()), HangSo.LoaiBenhNhan.pTiepDon);
            _chidinh.Show();
            base.Controls.Add(_chidinh);
            _chidinh.Location = new Point(0, 0);
            _chidinh.Width = base.Width;
            _chidinh.Height = base.Height;
            _chidinh.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
            _chidinh.BringToFront();
        }

        private void sbtnluu_Click(object sender, EventArgs e)
        {
            if (this.f_kiemtra_luu())
            {
                dtoBNThongTinBN thongTinBN = new dtoBNThongTinBN(this._xuli.pConFigData) {
                    DIACHI = this.txtdiachi.Text,
                    DIENTHOAI = this.txtdienthoai.Text,
                    HOTEN = this.txthoten.Text,
                    IDGIOITINH = this.rdbnam.Checked ? 0 : 1,
                    MABN = "",
                    NAMSINH = Convert.ToInt16(this.txtnamsinh.Text),
                    NGAYSINH = this.txtngaysinh.Text
                };
                try
                {
                    thongTinBN.IDPHUONGXA = long.Parse(this.txtmaphuongxa.Tag.ToString());
                }
                catch
                {
                }
                dtoBNTiepDon tiepDon = new dtoBNTiepDon(this._xuli.pConFigData) {
                    pCANNANG = this.txtcannang.Text,
                    pHUYETAP = this.txthuyetap.Text,
                    pIDQL = 0L,
                    pLYDOKHAM = this.txtlydokham.Text,
                    pMABN = thongTinBN.MABN,
                    pMACH = this.txtmach.Text,
                    pNGAY = this.datengaygio.Text,
                    pNHIETDO = this.txtnhietdo.Text,
                    pSTT = Convert.ToInt16(this.txtstt.Text),
                    pIDDANGNHAP = this._iiddangnhap,
                    pTUOIVAO = "",
                    pIDPHONG = Convert.ToInt32(this.lkephong.EditValue)
                };
                dtoBNThongTinBN_LienHe lienHe = new dtoBNThongTinBN_LienHe(this._xuli.pConFigData) {
                    DIENTHOAI = "",
                    IDQL = 0L,
                    MABN = tiepDon.pMABN
                };
                string text = "";
                if (this.txtmabn2.Text == "")
                {
                    text = this._objtiepdon.f_get_capMabn();
                }
                else
                {
                    text = this.txtmabn2.Text;
                }
                lienHe.MABN = tiepDon.pMABN = thongTinBN.MABN = text;
                long num = long.Parse(this.datengaygio.Tag.ToString());
                if (num == 0L)
                {
                    num = this._objtiepdon.f_insert_tiepdon(thongTinBN, tiepDon, lienHe);
                    if (num == 0L)
                    {
                        MessageBox.Show("Kh\x00f4ng lưu được th\x00f4ng tin đăng k\x00fd kh\x00e1m bệnh.", "Th\x00f4ng b\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                        return;
                    }
                }
                else
                {
                    lienHe.IDQL = tiepDon.pIDQL = num;
                    if (num == this._objtiepdon.f_update_tiepdon(tiepDon, lienHe))
                    {
                        MessageBox.Show("Kh\x00f4ng lưu được th\x00f4ng tin đăng k\x00fd kh\x00e1m bệnh.", "Th\x00f4ng b\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                        return;
                    }
                }
                this.txtmabn2.Text = thongTinBN.MABN;
                this.datengaygio.Tag = num.ToString();
                this.f_loadcontrol_caclandk(thongTinBN.MABN);
                this.f_loadcontrol_chophepsua(false);
            }
        }

        private void sbtnsua_Click(object sender, EventArgs e)
        {
            if (!(this.datengaygio.Tag.ToString() == "0"))
            {
                this.f_loadcontrol_chophepsua(true);
            }
        }

        public virtual void stbnketthuc_Click(object sender, EventArgs e)
        {
            XtraTabPage parent = (XtraTabPage) base.Parent;
            XtraTabControl control = (XtraTabControl) parent.Parent;
            control.TabPages.Remove(parent);
        }

        private void stbntieptheo_Click(object sender, EventArgs e)
        {
            this.f_loaddata_danhsachbn();
            this.f_loadcontrol_benhnhan("", "", 0, "", "", "", "", 0L);
            this.f_loadcontrol_thongtintd(0L, DateTime.Now.ToString("dd/MM/yyyy HH:mm"), 1, 1M, "", "", "", "", 1, "");
            this.tldk.Nodes.Clear();
            base.ActiveControl = this.txtmabn2;
            this.f_loadcontrol_chophepsua(true);
        }

        private void tldk_FocusedNodeChanged(object sender, FocusedNodeChangedEventArgs e)
        {
            this.f_loadcontrol_thongtintd(0L, DateTime.Now.ToString("dd/MM/yyyy HH:mm"), 1, 1M, "", "", "", "", 1, "");
            try
            {
                DataRow row = this._dttiepdon.Select("idql=" + long.Parse(e.Node.GetValue(this.tldk_idql).ToString()))[0];
                this.f_loadcontrol_thongtintd(long.Parse(row["idql"].ToString()), row["ngay"].ToString(), int.Parse(row["iddoituong"].ToString()), Convert.ToDecimal(row["idphong"].ToString()), row["mach"].ToString(), row["nhietdo"].ToString(), row["huyetap"].ToString(), row["cannang"].ToString(), int.Parse(row["stt"].ToString()), row["lydokham"].ToString());
            }
            catch
            {
            }
        }

        private void txthoten_Enter(object sender, EventArgs e)
        {
            this.ctrdanhsach_bn.Width = (this.txthoten.Location.X + this.txthoten.Width) - this.txtmabn2.Location.X;
            this.ctrdanhsach_bn.DanhSachCotHienThi_kt = string.Concat(new object[] { this.txtmabn2.Width + ",", ((this.ctrdanhsach_bn.Width - 0x52) - 200) - this.txtmabn2.Width, ",", 30 + ",", 50 + ",", 200 });
            this.ctrdanhsach_bn.Height = 90;
            this.ctrdanhsach_bn.Location = new Point(this.txtmabn2.Location.X, (this.txtmabn2.Location.Y + this.txtmabn2.Height) + 1);
            this.ctrdanhsach_bn.BringToFront();
        }

        private void txthoten_KeyDown(object sender, KeyEventArgs e)
        {
            if ((e.KeyCode == Keys.Up) || (e.KeyCode == Keys.Down))
            {
                this.ctrdanhsach_bn.Visible = true;
                this.ctrdanhsach_bn.Focus();
            }
            else if (e.KeyCode == Keys.Escape)
            {
                this.ctrdanhsach_bn.Visible = false;
            }
            else if (e.KeyCode == Keys.Enter)
            {
                if (this.ctrdanhsach_bn.Visible)
                {
                }
                this.ctrdanhsach_bn.Visible = false;
                base.ActiveControl = this.rdbnam;
            }
            else
            {
                this.ctrdanhsach_bn.Visible = false;
                this.ucbn_tiepdon_KeyDown(sender, e);
            }
        }

        private void txthoten_TextChanged(object sender, EventArgs e)
        {
            try
            {
                if (this.txthoten.IsEditorActive)
                {
                    if (!this.ctrdanhsach_bn.Visible)
                    {
                        this.ctrdanhsach_bn.Visible = true;
                    }
                    CurrencyManager manager = (CurrencyManager) this.BindingContext[this.ctrdanhsach_bn.SetDataSource];
                    DataView list = (DataView) manager.List;
                    list.RowFilter = "hoten like'" + this.txthoten.Text + "%'";
                }
            }
            catch
            {
            }
        }

        private void txtmabn2_Validated(object sender, EventArgs e)
        {
            if (this.txtmabn2.Text != "")
            {
                string str = "";
                string str2 = "";
                if (this.txtmabn2.Text.Length <= 4)
                {
                    str = this.txtmabn2.Text;
                }
                else
                {
                    str = this.txtmabn2.Text.Substring(0, 4);
                    str2 = this.txtmabn2.Text.Substring(4);
                }
                this.txtmabn2.Text = str.PadRight(4, '0') + str2.PadLeft(6, '0');
                string text = this.txtmabn2.Text;
                this.f_loadcontrol_benhnhan(text, "", 0, "", "", "", "", 0L);
                dtoBNThongTinBN nbn = new dtoBNThongTinBN(this._xuli.pConFigData) {
                    MABN = text
                };
                nbn.Load();
                if (nbn.HOTEN != "")
                {
                    this.f_loadcontrol_benhnhan(nbn.MABN, nbn.HOTEN, nbn.IDGIOITINH, nbn.NGAYSINH, nbn.NAMSINH.ToString(), nbn.DIACHI, nbn.DIENTHOAI, nbn.IDPHUONGXA);
                    this.f_loadcontrol_caclandk(text);
                    if (this.sbtnluu.Enabled)
                    {
                        this.f_loadcontrol_thongtintd(0L, DateTime.Now.ToString("dd/MM/yyyy HH:mm"), 1, 1M, "", "", "", "", 1, "");
                    }
                }
            }
        }

        private void txtmaphuongxa_Validated(object sender, EventArgs e)
        {
            this.f_setcontrol_phuongxa(this.txtmaphuongxa.Text, 0L);
        }

        private void txtnamsinh_Validated(object sender, EventArgs e)
        {
            try
            {
                DateTime time = this._objtiepdon.f_tinh_ngaytuoi(this.txtngaysinh.Text, int.Parse(this.txtnamsinh.Text), 0, 0);
                this.txttuoi.Text =string.Concat(DateTime.Now.Year - time.Year);
            }
            catch
            {
                this.txttuoi.Text = "0";
            }
        }

        private void txtngaysinh_Validated(object sender, EventArgs e)
        {
            try
            {
                DateTime time = this._objtiepdon.f_tinh_ngaytuoi(this.txtngaysinh.Text, (this.txtnamsinh.Text == "") ? 0 : int.Parse(this.txtnamsinh.Text), 0, 0);
                this.txtnamsinh.Text = time.Year.ToString();
                this.txttuoi.Text =string.Concat(DateTime.Now.Year - time.Year);
            }
            catch
            {
                this.txttuoi.Text = "0";
            }
        }

        private void txttuoi_Validated(object sender, EventArgs e)
        {
            try
            {
                DateTime time = this._objtiepdon.f_tinh_ngaytuoi("", 0, Convert.ToInt16(this.txttuoi.Text), int.Parse(this.lkploaituoi.EditValue.ToString()));
                if (int.Parse(this.lkploaituoi.EditValue.ToString()) != HangSo.LoaiTuoi.pTuoi)
                {
                    this.txtngaysinh.Text = time.ToString("dd/MM/yyyy");
                }
                this.txtnamsinh.Text = time.ToString("yyyy");
            }
            catch
            {
            }
        }

        private void ucbn_tiepdon_ControlRemoved(object sender, ControlEventArgs e)
        {
            if (e.Control.Name == "ucbn_thongtinbn")
            {
                try
                {
                    this.txtmabn2.Text = this._ucbn.pMaBNChon;
                    this._ucbn = null;
                    this.txtmabn2_Validated(null, null);
                    this.datengaygio.Focus();
                }
                catch
                {
                }
            }
        }

        private void ucbn_tiepdon_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F2)
            {
                if (this.sbtntieptheo.Enabled)
                {
                    this.stbntieptheo_Click(null, null);
                }
            }
            else if (e.KeyCode == Keys.F3)
            {
                if (this.sbtnsua.Enabled)
                {
                    this.sbtnsua_Click(null, null);
                }
            }
            else if (e.KeyCode == Keys.F5)
            {
                if (this.sbtnluu.Enabled)
                {
                    this.sbtnluu_Click(null, null);
                }
            }
            else if (e.KeyCode == Keys.F4)
            {
                if (this.sbtnboqua.Enabled)
                {
                    this.sbtnboqua_Click(null, null);
                }
            }
            else if (e.KeyCode == Keys.F7)
            {
                if (this.sbtnchidinh.Enabled)
                {
                    this.sbtnchidinh_Click(null, null);
                }
            }
            else if (e.KeyCode == Keys.Enter)
            {
                SendKeys.Send("{Tab}");
            }
            else if (e.KeyCode == Keys.F12)
            {
                this.stbnketthuc_Click(null, null);
            }
        }

        private void ucbn_tiepdon_Load(object sender, EventArgs e)
        {
            this._objtiepdon = new BNTiepDon(this._xuli.pConFigData);
            this.datengaygio.EditValue = DateTime.Now;
            DataTable table = HangSo.LoaiTuoi.f_DanhSach();
            this.lkploaituoi.Properties.DataSource = table;
            this.lkploaituoi.Properties.DisplayMember = "ten";
            this.lkploaituoi.Properties.ValueMember = "id";
            this.lkploaituoi.ItemIndex = 0;
            table = new BNDanhMuc(this._xuli.pConFigData).f_loaddata_bn_dmphong(true);
            this.lkephong.Properties.DataSource = table;
            this.lkephong.Properties.DisplayMember = "ten";
            this.lkephong.Properties.ValueMember = "id";
            this.lkephong.ItemIndex = 0;
            this.stbntieptheo_Click(null, null);
            base.ActiveControl = this.txtmabn2;
        }
    }
}

